package com.fang.mmy.items.config;

import feign.Request;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

/**
 * @ClassName OpenFeignConfig
 * @Author kebukeyi
 * @Date 2022/8/7 22:18
 * @Description
 * @Version 1.0.0
 */
@Configuration
public class OpenFeignConfig {

    /**
     * 日志配置
     * @return
     */
    /*@Bean
     public Logger.Level feignLoggerLevel(){
         return Logger.Level.FULL;
     }*/

    /**
     * 修改契约配置，支持Feign原生的注解
     * @return
     */
    /*@Bean
    public Contract feignContract(){
        return new Contract.Default();
    }*/

    /**
     * 超时时间配置
     *
     * @return
     */
    @Bean
    public Request.Options options() {
        return new Request.Options(5000, TimeUnit.MILLISECONDS, 10000, TimeUnit.MILLISECONDS, false);
    }

    /**
     * 自定义feign拦截器
     *
     * @return
     */
    @Bean
    public CustomFeignInterceptor customFeignInterceptor() {
        return new CustomFeignInterceptor();
    }
}
